require(['select2','uploadify'], function () {
    var $drvExamFile = $("#drvExamFile"),$drvExamFileUpload = $("#drvExamFileUpload");
    var corpId;
	importDriverExam = function (_corpId,_orgId){
    	corpId=_corpId;

		try{
			$drvExamFile.uploadify('cancel', '*');
		}catch(e){}
	};

	// 文件上传插件初始化
	$drvExamFile.uploadify({
		swf :  $.getProjectName() + "/component/uploadify/uploadify.swf",
		uploader : $.getProjectName()+"/baseDriverExamInfo/uploadDrvExamFile.htm",
		fileObjName : 'drvExamFile',
		fileDataName : 'drvExamFile',
		debug : false,
		auto : true,
		multi: false,
		method : 'post',
		height : 28,
		width : 150,
		buttonText : '选择文件',
		fileTypeDesc : '只能上传是xls和xlsx文件',
		fileTypeExts : '*.xls;*.xlsx',
		buttonClass : 'uploadify-bnt',
		successTimeout : 3000,
		buttonCursor:'hand',
		onUploadStart: function (file) {//在onUploadStart事件中，也就是上传之前，把参数写好传递到后台。
			$drvExamFile.uploadify("settings", "formData", {"corpId":corpId});
			$mask = $.createMask()  //遮罩
		},
		onUploadSuccess : function(file,data,response){
			$mask.remove();   //取消遮罩
//			errCorpId = $("#drvExamCorpId").val();
			if(response){
				msg = jQuery.parseJSON(data);
				console.info(msg);
				if(msg.msgType !== '1'){ // 有错误信息
					if (msg.msgType === '2') {
						$.messager.alert("警告", msg.warnMsg || "系统异常", "warning");
					}else if (msg.msgType === '3') {
						$.messager.alert("错误", msg.errorMsg || "系统异常", "error");
					}
				}else{ // 没有错误信息
					$.messager.alert("提示", msg.msg, "info",function(){
						this.__closeSelf();
					});
				}
			}else{
				$.messager.alert("提示","文件上传无响应！","info");
			}
		}
	});

});